
#ifndef XPLAY_XLOG_H
#define XPLAY_XLOG_H

class XLog {

};
#ifdef ANDROID
#include <android/log.h>
#include <mutex>

#define XLOGD(...) __android_log_print(ANDROID_LOG_DEBUG,"SSPlay",__VA_ARGS__)
#define XLOGI(...) __android_log_print(ANDROID_LOG_INFO,"SSPlay",__VA_ARGS__)
#define XLOGE(...) __android_log_print(ANDROID_LOG_ERROR,"SSPlay",__VA_ARGS__)
#else
#define XLOGD(...) printf("Utils",__VA_ARGS__)
#define XLOGI(...) printf("Utils",__VA_ARGS__)
#define XLOGE(...) printf("Utils",__VA_ARGS__)

#endif

#define toJ(handle) memory::jlongFromPointer((handle))
#define fromJ(type, handle) reinterpret_cast<type *>((handle))




#define MP_RET_IF_FAILED(ret) \
    do { \
        int retval = ret; \
        if (retval != 0) return (retval); \
    } while(0)

#define MPST_RET_IF_EQ_INT(real, expected, errcode) \
    do { \
        if ((real) == (expected)) return (errcode); \
    } while(0)

#define MPST_RET_IF_EQ_NOT(real, expected, errcode) \
    do { \
        if ((real) == (expected)) return ; \
    } while(0)

#define MPST_RET_IF_EQ(real, expected) \
    MPST_RET_IF_EQ_INT(real, expected, EIJK_INVALID_STATE)

#define MPST_RET_IF_EQ2(real, expected) \
    MPST_RET_IF_EQ_NOT(real, expected, EIJK_INVALID_STATE)

//sleep 毫秒
void XSleep(int mis);

#define __NEED_LOG__ 1

class AutoCompleteLog
{
public:
    AutoCompleteLog(const char* format, ... );
    ~AutoCompleteLog();

private:
    char buf[1024] = {0};
};

#endif //XPLAY_XLOG_H
